<?php
class JPush
{
    public function __construct ()
    {
        //
        $this->_api = new Jpush_API;
    }

    public function alert_2_all ($title, $message, $url, $startActivity, $builder_id = 1)
    {
        $targets = 'all';
        $result = $this->_api->alert($targets, $title, $message, $url, $startActivity, $builder_id);

        //
        // records into DB
        //

    }

    public function alert_2_tagslist ($arrTags, $title, $message, $url, $startActivity, $builder_id = 1)
    {
        $targets = array('tag' => $arrTags);
        $result = $this->_api->alert($targets, $title, $message, $url, $startActivity, $builder_id);
        //
        // records into DB
        //

    }

    public function alert_2_aliaslist ($arrAlias, $title, $message, $url, $startActivity, $builder_id = 1)
    {
        $targets = array('alias' => $arrAlias);
        $result = $this->_api->alert($targets, $title, $message, $url, $startActivity, $builder_id);
        Kohana::$log->add(Log::DEBUG, "aliasList:". print_r($arrAlias, TRUE));

        //
        // records into DB
        //

    }

    public function getAlias($userRegId)
    {
        $result = $this->_api->getAlias($userRegId);
        print_r($result);
    }

    public function setAlias($userRegId, $alias)
    {
        $result = $this->_api->setAlias($userRegId, $alias);
        return $result;
    }

    public function setTags ($userRegId, $arrAddTags, $arrDelTags)
    {
        $result = $this->_api->setTags($userRegId, $arrAddTags, $arrDelTags);
        print_r($result);
    }
}
